﻿@model IEnumerable<MvcCoffeeShop.DataTransferObjects.CartItemDTO>
@{
    ViewBag.Title = "Shopping Cart";
}

<h2>Shopping Cart</h2>

  @if (Session[MvcCoffeeShop.SharedConstants.cSession_MvcShoppingCartItemsCount] == null ||
      (int)Session[MvcCoffeeShop.SharedConstants.cSession_MvcShoppingCartItemsCount] == 0)
      {
         <h3>No Items are currently in the shopping cart.</h3>
      }

@using (Html.BeginForm())
 {
            <table style="border-width:1px;border-style:solid;">
     
                 @foreach (var item in Model)
                    {
                       <tr>
                        <td>
                            <img src="/Images/MvcCoffeeShop/@Url.Content(item.PicturePath)" />
                        </td>
                        <td>
                            @item.ProductName
                        </td>
                        <td>
                            @item.UnitPrice 
                        </td>
                        <td>
                            @item.Quantity 
                        </td>
                        <td>
                            <h3>
                             @Html.ActionLink("Remove", "removeFromCart", "ShoppingCart", new { cartitemid = item.ShoppingCartItemID },null)
                            </h3>
                        </td>
                       </tr>
                    }
        
              </table>
        
}

@if (Session[MvcCoffeeShop.SharedConstants.cSession_MvcShoppingCartItemsCount] != null)
      {
         <h3>@Html.ActionLink("Continue Shopping", "Catalog", "Home")</h3>
       if ((int)Session[MvcCoffeeShop.SharedConstants.cSession_MvcShoppingCartItemsCount] > 0)
       {
         <h3>@Html.ActionLink("Check Out", "CheckOut", "ShoppingCart")</h3>
       }
      }